﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using PPI.Data.Inspection;
using PPI.Entities.Interface;
using PPI.Mobile;

namespace PPI.ServiceLogic.Inspections
{
    public class LCompany : IMobileTable
    {
        public static DataSet SelectAll(string connectionKey)
        {
            return DInspectionCompany.SelectAll(connectionKey);
        }

        public List<EMobileQuery> CreateInsertMobileQuery(string connectionKey)
        {
            List<EMobileQuery> listQueries = new List<EMobileQuery>();
            listQueries.Add(new EMobileQuery("Delete tb_Companies"));
            DataTable dt = SelectAll(connectionKey).Tables[0];

            foreach (DataRow dr in dt.Rows)
            {
                listQueries.Add(new EMobileQuery("insert into tb_Companies (CompanyId,Name) values(" + Convert.ToInt32(dr["UtilityId"]) + ", '" + dr["Name"].ToString() + "')"));
            }
            return listQueries;
        }
    }
}
